<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin:0;
            padding:0;
        }
        .box1,.box2{
            height:100px;
            width:100px;
            background-color: red;
        }
        .box1{
            margin-bottom:-20px;
        }
        .box2{
            /* 正正取大正  20px 50px   50px
               正负取和    -20px 50px  30px
               负负取小负  -20px -50px -50px
            */
            margin-top:-50px;
            background-color: aqua;
        }
    </style>
</head>
<body>
    <div class="box1"></div>
    <div class="box2"></div>
</body>
</html>